
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: class Resource</title>
</head><body bgcolor="#f0f0f8">
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Resource">class <strong>Resource</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>A&nbsp;class&nbsp;for&nbsp;interacting&nbsp;with&nbsp;a&nbsp;resource.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Resource-__init__"><strong>__init__</strong></a>(self)</dt></dl>

<dl><dt><a name="Resource-runpagespeed"><strong>runpagespeed</strong></a> = method(self, **kwargs)</dt><dd><tt>Runs&nbsp;Page&nbsp;Speed&nbsp;analysis&nbsp;on&nbsp;the&nbsp;page&nbsp;at&nbsp;the&nbsp;specified&nbsp;URL,&nbsp;and&nbsp;returns&nbsp;a&nbsp;Page&nbsp;Speed&nbsp;score,&nbsp;a&nbsp;list&nbsp;of&nbsp;suggestions&nbsp;to&nbsp;make&nbsp;that&nbsp;page&nbsp;faster,&nbsp;and&nbsp;other&nbsp;information.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;locale:&nbsp;string,&nbsp;The&nbsp;locale&nbsp;used&nbsp;to&nbsp;localize&nbsp;formatted&nbsp;results<br>
&nbsp;&nbsp;rule:&nbsp;string,&nbsp;A&nbsp;Page&nbsp;Speed&nbsp;rule&nbsp;to&nbsp;run;&nbsp;if&nbsp;none&nbsp;are&nbsp;given,&nbsp;all&nbsp;rules&nbsp;are&nbsp;run&nbsp;(repeated)<br>
&nbsp;&nbsp;strategy:&nbsp;string,&nbsp;The&nbsp;analysis&nbsp;strategy&nbsp;to&nbsp;use<br>
&nbsp;&nbsp;&nbsp;&nbsp;Allowed&nbsp;values<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;desktop&nbsp;-&nbsp;Fetch&nbsp;and&nbsp;analyze&nbsp;the&nbsp;URL&nbsp;for&nbsp;desktop&nbsp;browsers<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mobile&nbsp;-&nbsp;Fetch&nbsp;and&nbsp;analyze&nbsp;the&nbsp;URL&nbsp;for&nbsp;mobile&nbsp;devices<br>
&nbsp;&nbsp;url:&nbsp;string,&nbsp;The&nbsp;URL&nbsp;to&nbsp;fetch&nbsp;and&nbsp;analyze&nbsp;(required)<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;An&nbsp;object&nbsp;of&nbsp;the&nbsp;form<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;"kind":&nbsp;"pagespeedonline#result",&nbsp;#&nbsp;Kind&nbsp;of&nbsp;result.<br>
&nbsp;&nbsp;&nbsp;&nbsp;"formattedResults":&nbsp;{&nbsp;#&nbsp;Localized&nbsp;Page&nbsp;Speed&nbsp;results.&nbsp;Contains&nbsp;a&nbsp;ruleResults&nbsp;entry&nbsp;for&nbsp;each&nbsp;Page&nbsp;Speed&nbsp;rule&nbsp;instantiated&nbsp;and&nbsp;run&nbsp;by&nbsp;the&nbsp;server.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"locale":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;The&nbsp;locale&nbsp;of&nbsp;the&nbsp;formattedResults,&nbsp;e.g.&nbsp;"en_US".<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"ruleResults":&nbsp;{&nbsp;#&nbsp;Dictionary&nbsp;of&nbsp;formatted&nbsp;rule&nbsp;results,&nbsp;with&nbsp;one&nbsp;entry&nbsp;for&nbsp;each&nbsp;Page&nbsp;Speed&nbsp;rule&nbsp;instantiated&nbsp;and&nbsp;run&nbsp;by&nbsp;the&nbsp;server.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;"title":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Title&nbsp;of&nbsp;the&nbsp;page,&nbsp;as&nbsp;displayed&nbsp;in&nbsp;the&nbsp;browser's&nbsp;title&nbsp;bar.<br>
&nbsp;&nbsp;&nbsp;&nbsp;"version":&nbsp;{&nbsp;#&nbsp;The&nbsp;version&nbsp;of&nbsp;the&nbsp;Page&nbsp;Speed&nbsp;SDK&nbsp;used&nbsp;to&nbsp;generate&nbsp;these&nbsp;results.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"major":&nbsp;42,&nbsp;#&nbsp;The&nbsp;major&nbsp;version&nbsp;number&nbsp;of&nbsp;the&nbsp;Page&nbsp;Speed&nbsp;SDK&nbsp;used&nbsp;to&nbsp;generate&nbsp;these&nbsp;results.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"minor":&nbsp;42,&nbsp;#&nbsp;The&nbsp;minor&nbsp;version&nbsp;number&nbsp;of&nbsp;the&nbsp;Page&nbsp;Speed&nbsp;SDK&nbsp;used&nbsp;to&nbsp;generate&nbsp;these&nbsp;results.<br>
&nbsp;&nbsp;&nbsp;&nbsp;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;"score":&nbsp;42,&nbsp;#&nbsp;The&nbsp;Page&nbsp;Speed&nbsp;Score&nbsp;(0-100),&nbsp;which&nbsp;indicates&nbsp;how&nbsp;much&nbsp;faster&nbsp;a&nbsp;page&nbsp;could&nbsp;be.&nbsp;A&nbsp;high&nbsp;score&nbsp;indicates&nbsp;little&nbsp;room&nbsp;for&nbsp;improvement,&nbsp;while&nbsp;a&nbsp;lower&nbsp;score&nbsp;indicates&nbsp;more&nbsp;room&nbsp;for&nbsp;improvement.<br>
&nbsp;&nbsp;&nbsp;&nbsp;"responseCode":&nbsp;42,&nbsp;#&nbsp;Response&nbsp;code&nbsp;for&nbsp;the&nbsp;document.&nbsp;200&nbsp;indicates&nbsp;a&nbsp;normal&nbsp;page&nbsp;load.&nbsp;4xx/5xx&nbsp;indicates&nbsp;an&nbsp;error.<br>
&nbsp;&nbsp;&nbsp;&nbsp;"invalidRules":&nbsp;[&nbsp;#&nbsp;List&nbsp;of&nbsp;rules&nbsp;that&nbsp;were&nbsp;specified&nbsp;in&nbsp;the&nbsp;request,&nbsp;but&nbsp;which&nbsp;the&nbsp;server&nbsp;did&nbsp;not&nbsp;know&nbsp;how&nbsp;to&nbsp;instantiate.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"A&nbsp;String",<br>
&nbsp;&nbsp;&nbsp;&nbsp;],<br>
&nbsp;&nbsp;&nbsp;&nbsp;"pageStats":&nbsp;{&nbsp;#&nbsp;Summary&nbsp;statistics&nbsp;for&nbsp;the&nbsp;page,&nbsp;such&nbsp;as&nbsp;number&nbsp;of&nbsp;JavaScript&nbsp;bytes,&nbsp;number&nbsp;of&nbsp;HTML&nbsp;bytes,&nbsp;etc.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"otherResponseBytes":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Number&nbsp;of&nbsp;response&nbsp;bytes&nbsp;for&nbsp;other&nbsp;resources&nbsp;on&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"flashResponseBytes":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Number&nbsp;of&nbsp;response&nbsp;bytes&nbsp;for&nbsp;flash&nbsp;resources&nbsp;on&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"totalRequestBytes":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Total&nbsp;size&nbsp;of&nbsp;all&nbsp;request&nbsp;bytes&nbsp;sent&nbsp;by&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"numberCssResources":&nbsp;42,&nbsp;#&nbsp;Number&nbsp;of&nbsp;CSS&nbsp;resources&nbsp;referenced&nbsp;by&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"numberResources":&nbsp;42,&nbsp;#&nbsp;Number&nbsp;of&nbsp;HTTP&nbsp;resources&nbsp;loaded&nbsp;by&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"cssResponseBytes":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Number&nbsp;of&nbsp;uncompressed&nbsp;response&nbsp;bytes&nbsp;for&nbsp;CSS&nbsp;resources&nbsp;on&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"javascriptResponseBytes":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Number&nbsp;of&nbsp;uncompressed&nbsp;response&nbsp;bytes&nbsp;for&nbsp;JS&nbsp;resources&nbsp;on&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"imageResponseBytes":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Number&nbsp;of&nbsp;response&nbsp;bytes&nbsp;for&nbsp;image&nbsp;resources&nbsp;on&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"numberHosts":&nbsp;42,&nbsp;#&nbsp;Number&nbsp;of&nbsp;unique&nbsp;hosts&nbsp;referenced&nbsp;by&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"numberStaticResources":&nbsp;42,&nbsp;#&nbsp;Number&nbsp;of&nbsp;static&nbsp;(i.e.&nbsp;cacheable)&nbsp;resources&nbsp;on&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"htmlResponseBytes":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Number&nbsp;of&nbsp;uncompressed&nbsp;response&nbsp;bytes&nbsp;for&nbsp;the&nbsp;main&nbsp;HTML&nbsp;document&nbsp;and&nbsp;all&nbsp;iframes&nbsp;on&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"numberJsResources":&nbsp;42,&nbsp;#&nbsp;Number&nbsp;of&nbsp;JavaScript&nbsp;resources&nbsp;referenced&nbsp;by&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"textResponseBytes":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Number&nbsp;of&nbsp;uncompressed&nbsp;response&nbsp;bytes&nbsp;for&nbsp;text&nbsp;resources&nbsp;not&nbsp;covered&nbsp;by&nbsp;other&nbsp;statistics&nbsp;(i.e&nbsp;non-HTML,&nbsp;non-script,&nbsp;non-CSS&nbsp;resources)&nbsp;on&nbsp;the&nbsp;page.<br>
&nbsp;&nbsp;&nbsp;&nbsp;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;"id":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Canonicalized&nbsp;and&nbsp;final&nbsp;URL&nbsp;for&nbsp;the&nbsp;document,&nbsp;after&nbsp;following&nbsp;page&nbsp;redirects&nbsp;(if&nbsp;any).<br>
&nbsp;&nbsp;}</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table>
</body></html>